package Controlador;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class Singleton {

	private static EntityManager instance= null;
	
	//Cosntructor privado para que solo lo podamos llamar dede la clase
	private Singleton (){}
	
	public static EntityManager getInstance() {
		
		if (instance == null){
			EntityManagerFactory emf = Persistence.createEntityManagerFactory("ClienteService");
			instance = emf.createEntityManager();
		}
			
		return instance;
	}
}
